<template>
        <!-- 添加班次弹窗 -->
        <div>
                <!-- 功能栏 -->
            <div class = "add-container">
                <el-row>
                    <el-col :span="24">
                        <el-tabs v-model="tabAcitve" type="card" class="fun-tab">
                            <el-tab-pane label="基础资料" name="msg">
                                <el-row>
                                    <el-col :span="24">
                                        <!-- 左侧信息栏 -->
                                        <div class="left-msg">
                                            <!-- <div class="msg-row">
                                                <div class="lf choose-title">班次日期</div>
                                                <el-date-picker type="date" v-model="addClassDate" style="width: 130px;" size="mini" class="lf choose-input"></el-date-picker>
                                                <div class="lf choose-title">&nbsp; 至&nbsp;</div>
                                                <el-date-picker type="date" v-model="addClassDateTo" style="width: 130px;" size="mini"></el-date-picker>
                                                <div class="cb"></div>
                                            </div> -->
                                            <div class="msg-row">
                                                <div class="lf choose-title">线路
                                                    <span class = "red">*</span> </div>
                                                <el-input v-model="addRoad" size="mini" style="width:410px;margin-left:28px" class="choose-input"></el-input>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">班次号
                                                     <span class = "red">*</span></div>                    
                                                <el-input v-model="addClassNum" size="mini" style="width:140px;margin-left:14px" class="choose-input lf"></el-input>
                                                <el-time-select v-model="addCarTime" style="width: 140px;margin-left:14px" size="mini" class="rf" :picker-options="{start:'08:30',step:'00:15',end:'18:30'}"></el-time-select>
                                                <div class="rf choose-title">发车时间</div>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">座位数
                                                    <span class = "red">*</span> </div>                                            
                                                <el-input v-model="addSeatCount" size="mini" style="width:140px;margin-left:14px" class="choose-input lf"></el-input>
                                                <el-input v-model="addCarId" style="width: 140px;margin-left:14px" size="mini" class="rf"></el-input>
                                                <div class="rf choose-title">车牌号码</div>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">运营单位</div>
                                                <el-input v-model="addComp" size="mini" style="width:420px;" class="choose-input lf"></el-input>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">车型</div>
                                                <el-select v-model="addCarType" placeholder="请选择" size="mini" style="width:140px;margin-left:28px" class="lf choose-input">
                                                    <el-option
                                                    v-for="item in carList"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                                </el-select>
                                                <el-select v-model="addCompII" placeholder="请选择" size="mini" style="width:140px;margin-left:18px" class="rf choose-input">
                                                    <el-option
                                                    v-for="item in addCompList"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                                </el-select>
                                                <div class="rf choose-title">运营方式
                                                    <span class = "red">*</span>
                                                </div>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">座位类型
                                                    <span class = "red">*</span></div>                                               
                                                <el-select v-model="addSeatType" placeholder="请选择" size="mini" style="width:140px;" class="lf choose-input">
                                                    <el-option
                                                    v-for="item in seatTypeList"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                                </el-select>
                                                <el-select v-model="ClassType" placeholder="请选择" size="mini" style="width:140px;margin-left:18px;" class="rf choose-input">
                                                    <el-option
                                                    v-for="item in classTypeList"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                                </el-select>
                                                <div class="rf choose-title">班次类型
                                                    <span class = "red">*</span>
                                                </div>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">提前预售
                                                      <span class = "red">*</span></div>                                              
                                                <el-input v-model="beforeSell" size="mini" style="width:110px;" class="choose-input lf"></el-input><div class="lf choose-title">天</div>
                                                <el-input v-model="checkDoor" style="width: 140px;margin-left:28px" size="mini" class="rf choose-input"></el-input>
                                                <div class="rf choose-title">检票门</div>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">终点站</div>
                                                <el-input v-model="endStation" size="mini" style="width:140px;margin-left:14px" class="choose-input lf"></el-input>
                                                <el-input v-model="startPlace" style="width: 140px;margin-left:28px" size="mini" class="rf choose-input"></el-input>
                                                <div class="rf choose-title">发车卡位</div>
                                                <div class="cb"></div>
                                            </div>
                                            <div class="msg-row">
                                                <div class="lf choose-title">备注</div>
                                                <el-input v-model="beiZhu" size="mini" style="width:420px;margin-left:28px" class="choose-input lf" type="textarea"></el-input>
                                                <div class="cb"></div>
                                            </div>
                                            <!-- 选框 -->
                                            <el-checkbox v-model="checkStart">启用</el-checkbox>
                                            <el-checkbox v-model="checkPei">配客</el-checkbox>
                                            <el-checkbox v-model="checkAllow">允许远程售票</el-checkbox>
                                            <el-checkbox v-model="checkAddClass">不加班</el-checkbox>
                                            <br>
                                            <el-checkbox v-model="checkCarTime">打印发车时间</el-checkbox>
                                            <el-checkbox v-model="checkPintSeat">打印座位号</el-checkbox>
                                            <el-checkbox v-model="checkClassNum">打印班次号</el-checkbox>
                                        </div>
                                        <!-- 右侧图 -->
                                        <div class="right-img">
                                        </div>
                                    </el-col>
                                </el-row>
                                   <el-col :span="24">
                                    <button class="check-btn rf" @click="cencelWin">
                                        <img src="../../assets/imgs/operation_btn_icon_quxiao_default.png" alt="" class="btn-img">取消</button>
                                    <button class="check-btn rf" @click ="saveClass()"><img src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt="" class="btn-img" >确定</button>
                              </el-col>
                            </el-tab-pane>
                            <el-tab-pane label="票价" name="price"> 
                                 <div class = "left-set"  >
                                               <img src="../../assets/imgs/operation_icon_shanchu_default.png" alt="" class="lf" style = "margin-top: 5px;">
                                               <div class="lf choose-title fun-text" @click="TicDel">删除过期设置</div>
                                         <div class= "box-info choose-title"  v-for = "(item,index) in list" @mousemove ="showdetail(item,index)" @mouseout="hiddenMouse(item,index)">    
                                              <div class = "left-title" >
                                                <span>通用</span>
                                              </div>
                                              <div class = "right-time">
                                              <span class = "title-right">{{item.startdate}}</span>
                                              <div class = "title-center">至</div>
                                              <span  class = "title-right">{{item.enddate}}</span>                                              
                                              </div>
                                                    <div v-show = "item.flag" class = "flright">
                                                        <div class="lf choose-title fun-text box-hover"  @click = "opencopy">
                                                          <img src="../../assets/imgs/operation_icon_banci_default.png" alt="" class="lf">复制</div>
                                                              <div class="lf choose-title fun-text box-hover" @click="edit">
                                                         <img src="../../assets/imgs/operation_icon_xiugai_default.png" alt="" class="lf">修改</div>
                                                             <div class="lf choose-title fun-text box-hover" @click="ondelete">
                                                         <img src="../../assets/imgs/operation_icon_shanchu_default.png" alt="" class="lf">删除</div>
                                        </div>                               
                                  </div>        
                              </div>                                          
                                    <el-col :span="17" class="table-fun">
                                        <img src="../../assets/imgs/operation_icon_shuaxin_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="refreshTable">刷新</div>
                                        <img src="../../assets/imgs/operation_icon_tianjia_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="getPriceWin">添加</div>
                                        <!-- <img src="../../assets/imgs/operation_icon_xiugai_default.png" alt="" class="lf"><div class="lf choose-title fun-text">修改</div> -->
                                        <img src="../../assets/imgs/operation_icon_shanchu_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="TicDel">删除</div>
                                        <!-- <img src="../../assets/imgs/operation_icon_banci_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="TicUpdate">更新到同路线的所有班次</div> -->
                                      <div class = "margins" >
                                       <el-dropdown trigger = "click" @command="handleCommand">
                                       <img src="../../assets/imgs/operation_icon_shengcheng_default.png" alt="" class="" style = " margin-top: -3px;">
                                      <span class="el-dropdown-link">
                                        复制票价设置<i class="el-icon-arrow-down el-icon--right"></i>
                                      </span>
                                      <el-dropdown-menu slot="dropdown">
                                              <el-dropdown-item command="a">到同线路其他班次</el-dropdown-item>
                                              <el-dropdown-item command="b">到同线路同车型班次</el-dropdown-item>
                                            </el-dropdown-menu>
                                    </el-dropdown>
                                      <el-dropdown :hide-on-click="false" @command ="selector">
                                        <img src="../../assets/imgs/operation_icon_shengcheng_default.png" alt="" class="" style = " margin-top: -3px;">
                                        <span class="el-dropdown-link">
                                          生成票价设置<i class="el-icon-arrow-down el-icon--right"></i>
                                        </span>
                                        <el-dropdown-menu slot="dropdown">
                                          <el-dropdown-item command="a">生成本班次票价计划</el-dropdown-item>
                                          <el-dropdown-item command="b">生成并更新本班次票价计划</el-dropdown-item>
                                          <el-dropdown-item command="c">生成本线路票价计划</el-dropdown-item>
                                          <el-dropdown-item command="d">生成并更新本线路票价计划</el-dropdown-item>
                                        </el-dropdown-menu>
                                      </el-dropdown>
                                      </div>    
                                       <el-select v-model="Pricelist" placeholder= " 本站票价 " size="mini" @change ="selectValue"  style="width:120px;margin-top:-25px;" class="rf choose-input">
                                                    <el-option
                                                    v-for="item in options"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                      </el-select>
                                       <!-- <el-select v-model="Pricelist" placeholder="请选择" size="mini"  @change ="selectValue" style="width:140px;margin-left:28px" class="lf choose-input">
                                                    <el-option
                                                    v-for="item in options"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                         </el-select> -->
                                    </el-col>
                                    <div class = "prolese" >
                                        <avue-crud :data="banTable[0].data" :option="banTable[0].option" @current-row-change="rowChange" :page="this.banTable[0].page" @current-change="banTablePage">
                                                 <template slot-scope="props" slot="expand">
                                                      <p v-html = "html"></p>
                                                  </template>
                                           </avue-crud>            
                                    </div>
                                    <pop-submit :visible = isAddPrice  :width = width2 :height= height @changeVisible = cencel(6) title = "添加">

                                   </pop-submit>
                                     <pop-submit :visible = isDisp  :width = width2 :height= height @changeVisible = edit title = "票段设置">
                                 <slot>
                                     <banci-price-edit></banci-price-edit>
                                 </slot>
                              </pop-submit>
                                  <pop-submit :visible = coppys  :width = width2 :height= height @submit = getModList  @changeVisible = opencopy :title = "提示" >
                                 <slot>
                                     <p class = "" style = "font-size:19px;margin:30px;">本操作将把本班次各配客站的数据同步设置复制到当天同线路下其他班次中，是否确认继续？</p>
                                 </slot>
                              </pop-submit>
                               <pop-submit :visible = deletes  :width = width2 @submit = TicDel :height= height @changeVisible = ondelete   :title = "提示" >
                                 <slot>
                                     <p class = "" style = "font-size:19px;margin:30px;">您确定要删除此日期段？</p>
                                 </slot>
                              </pop-submit>
                              <!-- 复制班次票价定义 -->
                               <pop-submit :visible = isCar  :width = width3 :height= height3 @changeVisible = handleCommand  @submit = submitPrice(1)  :title = titles >
                                 <slot>
                                       <p class = "" style = "font-size:19px;margin:30px;">本操作将把票价定义复制到<b>同线路</b>下其他班次，是否确认继续？</p>
                                        <el-checkbox style = "margin:20px 30px;" v-model="checkStart">维持目标班次原票价状态</el-checkbox>
                                 </slot>
                              </pop-submit>
                             <!-- 复制班次票价定义 -->
                                 <pop-submit :visible = ClassCar  :width = width3 @submit = submitPrice(2) :height= height3 @changeVisible = cencel(1)   :title = titles >
                                 <slot>
                                       <p class = "" style = "font-size:19px;margin:30px;">本操作将把票价定义复制到<b>同线路</b>下其他班次，是否确认继续？</p>
                                        <el-checkbox style = "margin:20px 30px;" v-model="checkStart">维持目标班次原票价状态</el-checkbox>
                                 </slot>
                              </pop-submit>
                               <!-- 复制班次票价定义 -->
                                 <pop-submit :visible = planone  :width = width3 @submit = submitPrice(3) :height= height3 @changeVisible = cencel(2)  :title = titles >
                                 <slot>
                                       <p class = "" style = "font-size:19px;margin:30px;">是否确认生成本班次票价计划？</p>
                                 </slot>
                              </pop-submit>
                                 <pop-submit :visible = plan2  :width = width3 @submit = submitPrice(4) :height= height3 @changeVisible = cencel(3)  :title = titles >
                                 <slot>
                                       <p class = "" style = "font-size:19px;margin:50px;">是否确认生成<b style="color:red">（并更新已生成的）</b>本班次票价计划？</p>
                                 </slot>
                              </pop-submit>
                                 <pop-submit :visible = plan3  :width = width3 @submit = submitPrice(5) :height= height3 @changeVisible = cencel(4)  :title = titles >
                                 <slot>
                                       <p class = "" style = "font-size:19px;margin:30px;">是否确认生成本线路所有班次票价计划？</p>
                                 </slot>
                              </pop-submit>
                                 <pop-submit :visible = plan4  :width = width3 @submit = submitPrice(6) :height= height3 @changeVisible = cencel(5)  :title = titles >
                                 <slot>
                                       <p class = "" style = "font-size:19px;margin:30px;">是否确认生成<b style="color:red">（并更新已生成的）</b>本线路所有班次票价计划？</p>
                                 </slot>
                              </pop-submit>
                             </el-tab-pane>
                            <el-tab-pane label="配客" name="seat">
                                <el-row class="peiKe-fun">
                                    <el-col :span="24">
                                        <div class="lf choose-title">配客车站</div>
                                        <el-select v-model="peiKeSta" placeholder="请选择" size="mini" style="width:120px" class="lf choose-input">
                                            <el-option
                                            v-for="item in peiKeList"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <img src="../../assets/imgs/operation_icon_tianjia_default.png" alt="" class="lf peike-img"><div class="lf choose-title fun-text" @click="addSeat()">添加</div>
                                        <div class="rf choose-title fun-text" @click="new Funtion(isCopyCount = true,titles = '提示')">复制数据设置到同线路所有班次</div>
                                        <img src="../../assets/imgs/operation_icon_shengcheng_default.png" alt="" class="rf peike-img">
                                    </el-col>
                                </el-row>
                                <!-- 的数据同步设置复制到-->
                                   <pop-submit :visible = isCopyCount  :width = width3 @submit = TicTongbu :height= height3 @changeVisible = cencel(6)  :title = titles >
                                       <p class = "" style = "font-size:19px;margin:30px;">本操作将把本班次各配客站的数据同步设置复制到当天同线路下其他班次中，是否确认继续？</p>
                                  </pop-submit>
                                <!-- 配客信息栏 -->
                                <el-row>
                                  <el-col :span="24">
                                    <div class="peiKe-container" v-for="(item,index) of peiKeMsg" style = "margin:10px 0px">
                                      <div class="lf pk-num">{{item.idx || index + 1}}</div>
                                      <div class="lf pk-num">{{item.org_name || "顶级机构"}}</div>
                                      <div class="lf choose-title pk-text">发车时间：{{item.bus_time}}
                                            <el-time-select v-model="addCarTime" style="width: 140px;margin-left:14px" size="mini" class="rf" :picker-options="{start:'08:30',step:'00:15',end:'18:30'}"></el-time-select>
                                      </div>
                                      <div class="lf choose-title pk-text">班次号：{{item.bus_id}}
                                              <el-input v-model="addRoad" size="mini" style="width:410px;margin-left:28px" class="choose-input"></el-input>
                                      </div>
                                      <div class = "flos">
                                            <el-select>
                                                       <el-option
                                                        v-for="item in peiKeList"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value">
                                                      </el-option>
                                            </el-select>
                                              <el-select>
                                                       <el-option
                                                        v-for="item in peiKeList"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value">
                                                      </el-option>
                                            </el-select>
                                              <el-select>
                                                       <el-option
                                                        v-for="item in peiKeList"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value">
                                                      </el-option>
                                            </el-select>
                                              <el-select>
                                                       <el-option
                                                        v-for="item in peiKeList"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value">
                                                      </el-option>
                                            </el-select>
                                      </div>
                                      <div class="rf pk-main peis"></div>
                                      <div class="cb"></div>
                                    </div>
                                  </el-col>
                                </el-row>
                            </el-tab-pane>
                             <el-tab-pane label="排班" name="class">
                                <el-row class="peiKe-fun">
                                    <el-col :span="24">
                                     <el-row>
                                    <el-col :span="20" class="table-fun">
                                        <img src="../../assets/imgs/operation_icon_shuaxin_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="refreshTable">刷新</div>
                                        <img src="../../assets/imgs/operation_icon_tianjia_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="changeVisibles">添加</div>
                                        <img src="../../assets/imgs/operation_icon_xiugai_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click ="changeVisibles">修改</div>
                                        <img src="../../assets/imgs/operation_icon_shanchu_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="deleteClass">删除</div>    
                                        <img src="../../assets/imgs/operation_icon_shousuo_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="yulan('','预览排班计划')">预览排班计划</div>                                        
                                        <img src="../../assets/imgs/operation_icon_banci_default.png" alt="" class="lf"><div class="lf choose-title fun-text" @click="createPlan">更新到同路线的所有班次</div>
                                    </el-col>
                                       <avue-crud :data="paiClass.data" :option="paiClass.option"  ></avue-crud>
                                </el-row>
                            </el-col>
                                </el-row>
                                  <pop-submit :visible = isAdd  :width = width :height= height @changeVisible = changeVisibles title = "添加">
                              <slot>
                                 <class-sort></class-sort>
                             </slot>
                          </pop-submit>
                        <pop-submit :visible = isShow :width = width4 :height= height4 @changeVisible = "yulan" :title = tilte >
                              <avue-crud :data="paiClass.data" :option="paiClass.option" v-model="obj" ></avue-crud>
                        </pop-submit>
                            </el-tab-pane>
                        </el-tabs>
                    </el-col>
                </el-row>
            </div>  
        </div>  

</template>
<script>
import qs from "qs";
import DropDown from "../../components/common/dropdown"
import TableData from "../../components/common/tableData";
import FormData from "../../components/common/form"
import "../../assets/js/mouse.js"
import popSubmit from  "../../components/common/popDilog2";
import classSort from "../../views/banciPopSubTmpe/classSort";
import banciPriceEdit from "../../views/banciPopSubTmpe/banciPriceEdit";
import popDilog from  "../../components/common/popDilog";

var dd=new Date;
const DIC={
  openType:[
    {
      label:"当班",
      value:"1"
    },
    {
      label:"全部",
      value:"2"
    },
    {
      label:"按日期",
      value:"3"
    },
  ],
  tongBuSetting:[
    {
      label:"同步",
      value:"1"
    },
  ],
  longS:[
    {
      label:"",
      value:"1"
    }
  ],
  TongS:[
    {
      label:"",
      value:"1"
    }
  ],
  copyCheckList1:[
    {
      label:"座位",
      value:"seat"
    },
    {
      label:"票价",
      value:"price"
    },
    {
      label:"车牌",
      value:"vecho"
    },
    {
      label:"营运单位",
      value:"comp"
    },
    {
      label:"班车车型",
      value:"carStyle"
    },
    {
      label:"班次状态",
      value:"classState"
    },
    {
      label:"班次类型",
      value:"classStyle"
    },
    {
      label:"预售天数",
      value:"sellDay"
    },
    {
      label:"检票门",
      value:"checkDoor"
    },
    
  ],
  copyCheckList2:[
    {
      label:"发车卡位",
      value:"seat"
    },
    {
      label:"是否配套",
      value:"suitable"
    },
    {
      label:"是否启用",
      value:"startable"
    },
    {
      label:"是否加班",
      value:"isAdd"
    },
    {
      label:"允许远程售票",
      value:"sellFar"
    },
    {
      label:"终点站",
      value:"end"
    },
    {
      label:"打印班次时间",
      value:"printTime"
    },
    {
      label:"打印班次号",
      value:"printID"
    },
    {
      label:"打印座位号",
      value:"printSeat"
    },
  ]
};
export default {
  data: function() {
    return {
      isShow:false,
      isCar:false,
      ClassCar:false,
      planone:false,
      plan2:false,
      plan3:false,
      plan4:false,          
      titles:'',
      Pricelist:'',
         banTable: [
        {
          page: {
            pageSizes: [10],
            total: 2,
            currentPage: 1,
            pageSize: 10
          },
          data: [],
          option: {
            page: true,
            stripe: true,
            menu: false,
            expand:true,
            highlightCurrentRow:true,
            align: "center",
            menuAlign: "center",
            column: []
          }
        }
      ],
       options: [{
          value: '本站票价',
          label: '本站票价'
        }, {
          value: '本站及配客站票价',
          label: '本站及配客站票价'
        }, 
      ],
      obj:'',
      tilte:'',
      isAdd:false,
      isDisp:false,
      coppys:false,
      deletes:false,
      isCopyCount:false,
      width:'880px',
      height:'494px',
      width2:'600px',
      width3:'450px',
      width4:'1100px',
      height4:'880px',
      height3:'260px',
      html:'',
      classDate: "",
      currentRow:"",
      currentMsg:{},
      road: "",
      toPlace: "",
      dateFrom: "",
      dateTo: "",
      checkChoose: 1,
      chooseValue: "",
      chooseItem: [],
      classNum: "",
      addWin: false,
      addFunTab: "msg",
      addClassDate: "",
      addClassDateTo: "",
      carList: [],
      addCompII: "",
      addCompList: [],
      addSeatType: "",
      seatTypeList: [],
      ClassType: "",
      classTypeList: [],
      beforeSell: "",
      checkDoor: "",
      endStation: "",
      startPlace: "",
      beiZhu: "",
      checkStart: false,
      checkPei: false,
      checkAllow: false,
      checkAddClass: false,
      checkCarTime: false,
      checkPintSeat: false,
      checkClassNum: false,
      tWin: false,
      peiKeSta: "",
      peiKeList: [],
      carTable: [
        {
          page: {
            pageSizes: [10],
            total: 2,
            currentPage: 1,
            pageSize: 10
          },
          data: [],
          option: {
            page: true,
            stripe: true,
            menu: false,
            expand:true,
            align: "center",
            menuAlign: "center",
            highlightCurrentRow:true,
            column: []
          }
        }
      ],
      roadList:[],
      endList:[],
      checkRoadID:"",
      checkEndID:"",
       paiClass:{
        data:[],
        option:{
          highlightCurrentRow:true,
          menu:false,
          page:false,
          align:'center',
          menuAlign:'center',
          column:[
            {
              label:"起始日期",
              prop:"st_name"
            },
            {
              label:"结束日期",
              prop:"type_1"
            },
            {
              label:"排班类型",
              prop:"type_2"
            },
            {
              label:"备注",
              prop:"max_price"
            },
           
          ]
        }
      },
       modList: {
        seat_define_str: "test",
        "busDefine.seat_layout": "test2",
        "busDefine.line_id": "test3",
        lineName: "test4",
        "busDefine.bus_id": "test5",
        from_busdid: "test6",
        "busDefine.bus_time": "test7",
        "busDefine.all_seat": "test8",
        "busDefine.customer_id": "test9",
        "busDefine.vehi_type_id": "test10",
        "busDefine.seat_type": "test11",
        "busDefine.status_id": "test12",
        "busDefine.start_date": "test13",
        "busDefine.end_date": "test14",
        "busDefine.presell_day": "test15"
      },
      modCurrentRow:"",
      modTitle:"",
      peiKeMsg:[],
      seatShow:false,
      seatDetailList:{
        data:[],
        option:{
          menu:false,
          column:[
            {
              label:"座号",
              prop:"seat_id"
            },
            {
              label:"状态",
              prop:"status_cn"
            },
            {
              label:"工号",
              prop:"order_no"
            },
            {
              label:"操作时间",
              prop:"check_time"
            },
            {
              label:"票号",
              prop:"billno"
            },
            {
              label:"票型",
              prop:"tks_type"
            },
            {
              label:"购票渠道",
              prop:"test"
            },
            {
              label:"订单时间",
              prop:"order_time"
            },
          ]
        }
      },
      rightLineName:"请选择班次",
      rightStartWin:false,
      rStart:{},
      rStartForm:{
        dicData:DIC,
        column:[
          {
            label:"开班方式",
            prop:"openType",
            dicData: 'openType',
            type: "select",
            span:18
          },
          {
            label:"开始日期",
            prop:"startDate",
            span:18,
            type: "date"
          },
          {
            label:"结束日期",
            prop:"endDate",
            span:18,
            type: "date"
          },
          {
            label:"同步设置",
            prop:"tongBu",
            type: "checkbox",
            dicData: 'tongBuSetting',
            span:9,
          },
        ]
      },
      rightStopWin:false,
      rStop:{},
      rStopForm:{
        dicData:DIC,
        column:[
          {
            label:"长停",
            prop:"longStop",
            dicData:"longS",
            type:"checkbox",
            span:24
          },
          {
            label:"开始日期",
            prop:"beginDate",
            type:"date",
            span:12
          },
          {
            label:"结束日期",
            prop:"endDate",
            type:"date",
            span:12
          },
          {
            label:"同步设置",
            prop:"tongbuSet",
            dicData:"TongS",
            type:"checkbox",
            span:24
          },
          {
            label:"停班原因",
            prop:"stopRea",
            span:20
          },
        ]
      },
      rightSumWin:false,
      rightSumMsg:{},
      sumList:{
        data:[],
        option:{
          menu:false,
          index:true,
          page:false,
          highlightCurrentRow:true,
          column:[
            {
              label:"班次号",
              prop:"id"
            },
            {
              label:"时间",
              prop:"bus_date"
            },
            {
              label:"余座",
              prop:"cansalecount"
            },
          ]
        }
      },
      sumID:"",
      sumDate:"",
      sumMsg:{},
      sumBei:{},
      sumBeiOption:{
        menu:false,
        column:[
          {
            label:"备注",
            prop:"beizhu",
            span:24
          }
        ]
      },
      rightCopywin1:false,
      copyCheck:false,
      copyCheck2:false,
      rightCopywin2:false,
      rightCopyAll:false,
      copyForm:{},
      copyListOption:{
          column:[
            {
              label:"班次日期",
              prop:"BanCidate",
              type:"daterange",
              span:10
            },
            {
              label:"班次号",
              prop:"BCNum",
              span:5
            },
          ]
      },
      copyList:{
        data:[],
        option:{
          menu:false,
          index:true,
          selection:true,
          page:false,
          column:[
            {
              label:"班次号",
              prop:"bus_id"
            },
            {
              label:"班次日期",
              prop:"bus_date"
            },
            {
              label:"发班时间",
              prop:"bus_time"
            },
            {
              label:"班次类型",
              prop:"type"
            },
            {
              label:"状态",
              prop:"status_id"
            },
            {
              label:"总座数",
              prop:"all_seat"
            },
          ]
        }
      },
      copyCheck:{},
      copyCheckListOption:{
        dicData:DIC,
        column:[
          {
            label: "",
            prop: "ccl1",
            span: 24,
            type: "checkbox",
            dicData: 'copyCheckList1',
          },
          {
            label: "",
            prop: "ccl2",
            span: 24,
            type: "checkbox",
            dicData: 'copyCheckList2',
          },
        ]
      },
      list:[],
    };
  },
  props:{
    tabAcitve:{
     type:String,
     default:'class',
    },
    show:{
     type:Boolean,
     default:true,
    },
    addRoad:{
      type:String,
      default:' ',
    },
    addClassNum:{

    },
    addCarTime:{

    },
    addSeatCount:{

    },
    addCarId:{

    },
    addComp:{

    },
    addCarType:{

    },
    addSeatType:{},
    ClassType:{},
    beforeSell:{},
    checkDoor:{},
    endStation:{},
    startPlace:{},
    beiZhu:{},
    selctid:{
      type:String,
    },
  },
  methods: {
      tableCreate() {
      this.banTable[0].option.column.push(
            {},
            {
                 label:"启用",
                 prop:'',
            },
            {
              label:"站点名",
              prop:"st_name"
            },
            {
              label:"全票",
              prop:"type_1"
            },
            {
              label:"半票",
              prop:"type_2"
            },
            {
              label:"学生票",
              prop:"type_3"
            },
            {
              label:"老人票",
              prop:"type_4"
            },
            {
              label:"军残票",
              prop:"type_5"
            },
            {
              label:"回程票",
              prop:"type_6"
            },
            {
              label:"双程票",
              prop:"type_7"
            },
             {
              label:"员工票",
              prop:"type_8"
            },
             {
              label:"优惠票",
              prop:"type_9"
            },
            {
              label:"内部票",
              prop:"type_10"
            },
            {
              label:"春运票",
              prop:"type_11"
            },
             {
              label:"景点套票",
              prop:"type_12"
            },
              {
              label:"优惠票往",
              prop:"type_13"
            },
            {
              label:"上限票",
              prop:"max_price"
            },
              {
              label:"附加费",
              prop:"price"
            },
              {
              label:"",
              prop:"title"
            },
      );
    },
     createPlan(){
      this.$http.get("/sch/bus/define/makeplan?updateExistsBusPlan=true&overrideSeatLayout=true&makePricePlan=true&updateExistsPricePlan=true&bus_define_id=4084").then(data=>{
         if (data.data[0] == 0) {
            this.$message({
              message: '成功',
              type: "success"
            });
          } else {
            this.$message.error({
               message: '请求失败！'
            });
          }
      });
    },
     banTablePage(val){
      this.banTable[0].page.currentPage=val;
      this.getBanList();
    },
      getBanList()  {
      this.banTable[0].data=[];
      this.postRequest("/sch/bus/define/price/list",{
        rows:"10",
        page:this.banTable[0].page.currentPage
      })
        .then(data => {
          // console.log(data);
          this.banTable[0].page.total = data.data.totalRow;       
          this.banTable[0].page.currentPage = data.data.pageNumber;
          for (var d of data.data.list) {
            this.banTable[0].data.push({
              id:d.id,
              st_name:d.st_name,
              type_1: d.type_1,
              type_2: d.type_2,
              type_3: d.type_3,
              type_4: d.type_4,
              type_5: d.type_5,
              type_6: d.type_6,
              type_7: d.bus_7,
              type_8: d.type_8,
              type_9: d.type_9,
              type_10: d.type_10,
              type_11: d.type_11,
              type_12: d.type_12,
              type_13: d.type_13,
              max_price: d.max_price,
              price: d.price,
              title: d.title,
            });
          }
        });
    },
    getClasList()  {
      this.banTable[0].data=[];
      this.postRequest("/sch/bus/define/scheduling/list",{
        rows:"10",
        page:this.banTable[0].page.currentPage
      })
        .then(data => {
          console.log(data);
          this.banTable[0].page.total = data.data.totalRow;       
          this.banTable[0].page.currentPage = data.data.pageNumber;
            for (var d of data.data.list) {
            this.paiClass.data.push({
                
            })
          }
        })
    },
    submitPrice(number){
      switch(number){
        case 1:
              let defind = 2770;
             this.checkStart == true ? 1 : 0; 
            this.$http.get(`/sch/bus/define/price/copyToSameLine?bus_define_id=${defind}&keep_status=${this.checkStart}`).then(res => {
             this.$message({
              message: '复制成功',
              type: "success"
          })
          this.isCar = false;
      })   
        break;
        case 2:
             let definds = 2770;
             this.checkStart == true ? 1 : 0; 
             this.$http.get(`/sch/bus/define/price/copyToSameLineVehiType?bus_define_id=${definds}&keep_status=${this.checkStart}`).then(res => {
             this.$message({
              message: '复制成功',
              type: "success"
          })
          this.ClassCar = false;
      })  
            break;
        case 3:
             let updeta1 = 2770;
             this.checkStart == true ? 1 : 0; 
            //  let byLine = true ? 1  : 0;
             this.$http.get(`/sch/bus/define/price/makeplan?bus_define_id=${updeta1}&update=${updeta1}&keep_status=${this.checkStart}`).then(res => {
             this.$message({
             message: '生成完毕',
              type: "success"
             })
          })
          this.planone  = false;
        break;
        case 4:
              let updeta2= 2770;
             this.checkStart == true ? 1 : 0; 
            //  let byLine = true ? 1  : 0;
             this.$http.get(`/sch/bus/define/price/makeplan?bus_define_id=${updeta2}&update=${updeta2}&byLine=${this.checkStart}`).then(res => {
             this.$message({
              message: '生成完毕',
              type: "success"
             })
          })
          this.plan2 = false;
        break;
            case 5:
              let updeta3 = 2770;
             this.checkStart == true ? 1 : 0; 
            //  let byLine = true  ==  false ? 1  : 0;
             this.$http.get(`/sch/bus/define/price/makeplan?bus_define_id=${updeta3}&update=${updeta3}&byLine=${this.checkStart}`).then(res => {
             this.$message({
              message: '生成完毕',
              type: "success"
             })
          })
          this.plan3 = false;
        break;
        // /sch/bus/define/price/makeplan?bus_define_id=4084&update=0&byLine=0
         case 6:
              let updeta4 = 2770;
             this.checkStart == true ? 1 : 0; 
            //  let byLine = true ? 1  : 0;
             this.$http.get(`/sch/bus/define/price/makeplan?bus_define_id=${updeta4}&update=${updeta4}&byLine=${this.checkStart}`).then(res => {
             this.$message({
              message: '生成完毕',
              type: "success"
             })  
          })
          this.plan4 = false;
        break;
        default:
            return;
      }
    },
    cencelWin(){
      this.$emit("closeWin");
    },
      handleCommand(command,title = "") {
        // this.$message('click on item ' + command);
        if(command == 'a'){
          this.isCar = !this.isCar;
          title = '复制班次票价定义';
          this.titles = title;
        }else if(command == 'b'){
          title = '复制班次票价定义';
          this.titles = title;
          this.ClassCar = !this.ClassCar;
        }else{
           this.isCar = !this.isCar;
          return;  
        }
      },
      selector(command,title = ""){
        switch(command){
          case 'a':
          title = '';
          this.planone = !this.planone;
          break;
          case 'b':
          this.plan2 = !this.plan2;
          break;
          case 'c':
          this.plan3 = !this.plan3;
          break;
          case 'd':
          this.plan4 = !this.plan4;
          break;
        }
      },
      cencel(number){
         switch(number){
         case 1:
         this.ClassCar = !this.ClassCar;
         return;
         case 2:
         this.planone = !this.planone;
         return;
         case 3:
         this.plan2 = !this.plan2;
         return;
         case 4:
         this.plan3 = !this.plan3;
         return;
         case 5:
         this.plan4 = !this.plan4;
         break;
         case 6:
         this.isCopyCount = !this.isCopyCount;
         break;
         }
      },
    showdetail(item,index){
      return item.flag = true;
    },
    hiddenMouse(item,index){
      item.flag = false;
    },
     changeVisibles(){
      this.isAdd = !this.isAdd;
      // alert("222");
     },
      yulan(name,title){
      this.isShow = !this.isShow;
      // title === '添加班次' ? this.currentMsg = {} : title;
      this.activeTags = `${name}`;
      this.tilte = title;
     },
     edit(){
       this.isDisp = !this.isDisp;
     },
     opencopy(){
        this.coppys = !this.coppys;
     },
     ondelete(){
       this.deletes = !this.deletes;
     },
     /* 票价列表 */
     reuqestPrice(){
        let id = 2770;
        this.$http.get(`/sch/bus/define/price/date_scopes?bus_define_id=${id}`).then(res => {
           let list = res.data;
           let newarr = list.map((e,i,arr) => {
             e.flag = false;
             e.startdate = '2018-01-5'; 
             e.enddate = '2019-10-15';
             return e;
           })
           this.list = newarr;
        })
      
     },
     getPriceWin(){
           this.$http.get(`/sch/bus/define/price/detail?_=1535334661136`).then(res => {
           this.html = res.data;
            console.log(res.data);
        })

     },
    // 全部列表请求
    allList() {
      var that = this;
      that.carTable[0].data = [];
      this.postRequest("/sch/bus/plan/list",{
        page:this.carTable[0].page.currentPage,
        rows:this.carTable[0].page.pageSize
      }).then(data=>{
        // console.log(data);
        this.carTable[0].page.total=data.data.totalRow;
        this.carTable[0].data=data.data.list;
      });
    },
    getPeiUser(){
        this.$http.get(`/sch/bus/define/getViaStation?bus_define_id=4084`,).then(res => {
            this.peiKeMsg = res.data;
        })
    },
    /*  */
    addSeat(){
      if(this.peiKeMsg.length >= 3){return;}
      this.peiKeMsg.push({});
    },
    currentChange(val){
       var that = this;
      that.carTable[0].data = [];
      this.postRequest("/sch/bus/plan/list",{
        page:val,
        rows:this.carTable[0].page.pageSize
      }).then(data=>{
        // console.log(data);
        this.carTable[0].page.total=data.data.totalRow;
        this.carTable[0].data=data.data.list;
      });
    },
      mod() {
      this.$http
        .post(
          "/sch/bus/define/update",
          qs.stringify(this.modList)
        )
        .then(data => {
          if (data.data[0] == 0) {
            this.$message({
              message: data.data[1],
              type: "success"
            });
          } else {
            this.$message.error(data.data[1]);
          }
        });
    },  
     refreshTable() {
      (this.banTable[0].data = []), this.getBanList();
    },
    rowChange(val){
      // console.log(val.id);
      this.currentRow=val.id;
      this.currentMsg=val;
      this.currentMsg.line_name=val.line_name;
      this.currentMsg.bus_id=val.bus_id;
      this.currentMsg.bus_date=val.bus_date;
      this.currentMsg.end_seat=val.end_seat;
      this.currentMsg.status_id=val.status_id;
      this.currentMsg.vehi_no=val.vehi_no;
      this.currentMsg.checkdoor=val.checkdoor;
      this.currentMsg.kawei=val.kawei;
      // 配客弹窗数据
      this.$http.get("/sch/bus/plan/getViaStation?bus_plan_id="+val.id).then(data=>{
        this.peiKeMsg=[];
        for(var item of data.data){
          this.peiKeMsg.push({
            idx:item.idx,
            org_name:item.org_name,
            bus_id:item.bus_id,
            bus_time:item.bus_time
          });
        }
      });
      this.rightLineName=val.line_name;
      console.log(this.rightLineName);
    },
    check() {
      var that = this;
      that.carTable[0].data = [];
      this.postRequest("/sch/bus/plan/list",{
        filterRules: JSON.stringify([
            { field: "bus_plan.bus_date", op: 'eq', value: that.classDate=="" ? that.dateToString(new Date):that.dateToString(that.classDate)},
            { field: "bus_plan.line_id", op: "eq", value: that.checkRoadID },
            { field: "bus_plan_price.st_id", op: "eq", value: that.checkEndID },
            {
              field: "bus_plan.bus_id",
              op: 'eq',
              value: that.classNum
            }
          ]),
          page:"1",
          rows:"10"
      }).then(data=>{
        this.carTable[0].data=data.data.list;
      })
    },
    // 售票
    sell() {
      var that = this;
      this.postRequest("/sch/bus/plan/list",{
        filterRules: JSON.stringify([
              { field: "bus_plan.status_id", op: "eq", value: "1" }
            ]),
      }).then(data=>{
        this.carTable[0].data=data.data.list;
      })
    },
    reset() {
      this.classDate = "";
      this.road = "";
      this.toPlace = "";
      this.dateFrom = "";
      this.dateTo = "";
      this.chooseValue = "";
      this.classNum = "";
      this.carTable[0].data = [];
      this.allList();
    },
    // 弹窗
    addClass() {
      this.getSeatTypeList();
      this.getClassTypeList();
      this.getAddCompList();
      this.getChooseItem();
      this.getCarList();
      this.getPeiUser();
      this.reuqestPrice();
    },
    redClass() {
      this.addWin = false;
      this.addRoad="";
      this.addClassNum="";
      this.addCarTime="";
      this.addSeatCount="";
      this.addCarId="";
      this.startPlace="";
      this.addFunTab="msg"
    },
    saveClass() {
      this.$http
        .post(
          "/sch/bus/plan/add",
          qs.stringify({
            "busPlan.seat_layout":this.addSeatCount,
            "busPlan.id":this.addClassNum,
            new_bus_date_start:this.addClassDate,
            new_bus_date_end:this.addClassDateTo,
            "busPlan.line_id":this.addClassNum,
            lineName:this.addRoad,
            "busPlan.bus_id":this.addClassNum,
            "busPlan.bus_time":this.addCarTime,
            "busPlan.all_seat":this.addSeatCount,
            "busPlan.type":this.addComp,
            "busPlan.seat_type":this.addSeatType,
            "busPlan.status_id":this.addClassNum,
            "busPlan.presell_day":this.beforeSell,
          })
        )
        .then(data => {
          // console.log(data);
          if (data.data[0] == 0) {
            this.$message({
              message: data.data[1],
              type: "success"
            });
            this.getTicketList();
          } else {
            this.$message.error("信息有误或缺失请检查!");
          }
        });
    },
    deleteClass() {
      this.$http
        .post("/sch/bus/define/scheduling/del?id="+this.selctid)
        .then(data => {
          console.log(data);
          if (data.data[0] == -1) {
            this.$message.error("删除失败！");
          } else {
            this.$message({
              message: data.data[1],
              type: "success"
            });
          }
        });
    },
    showUpdateWin(){ 
      this.modTitle="修改班次";
      if(this.currentRow==""){
        this.$message.error('请选择一条记录');
      }else{
        this.addWin=true;
        this.addRoad=this.currentMsg.line_name;
        this.addClassNum=this.currentMsg.status_id;
        this.addCarTime=this.currentMsg.bus_date;
        this.addSeatCount=this.currentMsg.end_seat;
        this.addCarId=this.currentMsg.vehi_no;
        this.startPlace=this.currentMsg.kawei;
      }
    },
    TicTableMsg(){
      this.modTitle="修改班次";
      if(this.currentRow==""){
        this.$message.error('请选择一条记录');
      }else{
        this.addWin=true;
        this.addRoad=this.currentMsg.line_name;
        this.addClassNum=this.currentMsg.status_id;
        this.addCarTime=this.currentMsg.bus_date;
        this.addSeatCount=this.currentMsg.end_seat;
        this.addCarId=this.currentMsg.vehi_no;
        this.startPlace=this.currentMsg.kawei;
        this.addFunTab="price";
      }
    },
    peiKeTableMsg(){
      this.modTitle="修改班次";
      if(this.currentRow==""){
        this.$message.error('请选择一条记录');
      }else{
        this.addWin=true;
        this.addRoad=this.currentMsg.line_name;
        this.addClassNum=this.currentMsg.status_id;
        this.addCarTime=this.currentMsg.bus_date;
        this.addSeatCount=this.currentMsg.end_seat;
        this.addCarId=this.currentMsg.vehi_no;
        this.startPlace=this.currentMsg.kawei;
        this.addFunTab="seat";
      }
    },
    copyClass(){
      this.modTitle="复制班次";
      if(this.currentRow==""){
        this.$message.error('请选择一条记录');
      }else{
        this.addWin=true;
        this.addRoad=this.currentMsg.line_name;
        this.addClassNum=this.currentMsg.status_id;
        this.addCarTime=this.currentMsg.bus_date;
        this.addSeatCount=this.currentMsg.end_seat;
        this.addCarId=this.currentMsg.vehi_no;
        this.startPlace=this.currentMsg.kawei;
      }
    },
    update() {
      this.$http
        .post(
          "/sch/bus/plan/update",
          qs.stringify(this.updateList)
        )
        .then(data => {
          if (data.data[0] == 0) {
            this.$message({
              message: data.data[1],
              type: "success"
            });
          } else {
            this.$message.error(data.data[1]);
          }
        });
    },
    handleCurrentChange(val) {
      this.$http
        .post(
          "/sch/bus/plan/list",
          qs.stringify({ page: val })
        )
        .then(data => {
          for (var c of data.data.list) {
            that.carTable.push({
              line_name: c.line_name,
              bus_id: c.bus_id,
              bus_date: c.bus_date,
              status_id: c.status_id,
              customer_name: c.customer_name,
              id: c.id,
              bus_time: c.bus_time,
              cansalecount: c.cansalecount,
              salecount: c.salecount,
              salecount_owner_org: c.salecount_owner_org,
              end_seat: c.end_seat,
              checkdoor: c.checkdoor,
              kawei: c.kawei
            });
          }
        });
    },
    loadRoad(){
      this.$http.post("/sch/data/line/listWithSpell").then(data=>{
        console.log(data);
        for(var item of data.data){
          this.roadList.push({
            value:item.name,
            id:item.id
          });
        }
      });
    },
    loadEnd(){
      this.$http.post("/sch/data/station/listWithSpell").then(data=>{
        for(var item of data.data){
          this.endList.push({
            value:item.name,
            id:item.id
          });
        }
      });
    },
    querySearch(queryString, cb) {
        var roadlist = this.roadList;
        var results = queryString ? roadlist.filter(this.createFilter(queryString)) : roadlist;
        // 调用 callback 返回建议列表的数据
        cb(results);
    },
    createFilter(queryString) {
      return (roadlist) => {
        return (roadlist.value);
      }
    },
    querySearchEnd(queryString, cb) {
        var endlist = this.endList;
        var results = queryString ? endlist.filter(this.createFilter(queryString)) : endlist;
        // 调用 callback 返回建议列表的数据
        cb(results);
    },
    getSeatTypeList(){
      this.$http.post("/sch/data/common/busseattype").then(data=>{
        for(var item of data.data){
          this.seatTypeList.push({
            value:item.value,
            label:item.key
          });
        }
      })
    },
    getClassTypeList(){
      this.$http.post("/sch/data/common/busstatus").then(data=>{
        for(var item of data.data){
          this.classTypeList.push({
            value:item.key,
            label:item.value
          });
        }
      });
    },
    getAddCompList(){
      this.$http.post("/sch/data/common/bustype").then(data=>{
        // console.log(data);
        for(var item of data.data){
          this.addCompList.push({
            value:item.value,
            label:item.key
          });
        }
      });
    },
    getChooseItem(){
      this.$http.post("/common/constant/getYesOrNo").then(data=>{
        for(var item of data.data){
          this.chooseItem.push({
            value:item.value,
            label:item.key
          });
        }
      })
    },
    getModList(){
      this.$http.post("/sch/bus/define/price/list").then(data=>{
        for(var item of data.data.list){
          // let {} = data.data.list;
          this.pricd.data.push({
            first:'',
            next:'',
             first1:'',
            next1:'',
             first2:'',
            next2:'',
             first3:'',
            next4:'',
            st_name:item.st_name,
            type_1:item.type_1,
            type_2:item.type_2,
            firstPage:'',
            max_price:item.max_price,
            surcharges:item.surcharges,
            surcharges:item.surcharges
          });

        }
        console.log(data.data.list,this.pricd.data);
      })
    },
    getCarList(){
      this.$http.post("/sch/const/bus_vehicle_type/listWithSpell").then(data=>{
        for(var item of data.data){
          this.carList.push({
            value:item.id,
            label:item.name
          });
        }
      })
    },
    TicAdd(){
      this.$http.post("/sch/bus/define/price/add").then(data=>{
        console.log(data);
      });
    },
    TicDel(){
      if(this.selctid!=""){
        this.$http.get("/sch/bus/define/price/delOutdates?bus_define_id="+this.selctid).then(data=>{
            if(data.data[0]=="0"){
              this.$message({
              message: data.data[1],
              type: 'success'
              });
              this.selctid="";
            }else{
              this.$message.error(data.data[1]);
            }
        })
      }else{
        this.$message.error("请选择一条记录");
      }
    },
     TicUpdate(){
      this.$http.get("/sch/bus/plan/price/copyToSameLine?bus_plan_id="+this.currentRow+"&to_all_days=false&keep_status=1").then(data=>{
        if(data.data[0]=="0"){
              this.$message({
              message: data.data[1],
              type: 'success'
              });
              this.modCurrentRow="";
            }else{
              this.$message.error("更新失败！请检查");
            }
      });
    },
    TicTongbu(){
      this.$http.get("/sch/bus/plan/copyViaStationSyncConfig?bus_plan_id="+this.currentRow+"&all_days=0").then(data=>{
        if(data.data[0]=="0"){
              this.$message({
              message: data.data[1],
              type: 'success'
              });
              this.modCurrentRow="";
            }else{
              this.$message.error("更新失败！请检查");
            }
      })
    },
    getSeatDetailList(){
      var that=this;
      this.seatDetailList=[];
      this.$http.post("/sch/bus/plan/seat/list",qs.stringify({bus_plan_id:this.currentRow})).then(data=>{
        for(var item of data.data){
          that.seatDetailList.data.push({
            seat_id:item.seat_id,
            status_cn:item.status_cn,
            order_no:item.order_no,
            check_time:item.check_time,
            billno:item.billno,
            tks_type:item.tks_type,
            order_time:item.order_time
          });
        }
      });
    //   console.log(that.seatTypeList)
    },
    redSeat(){
      this.seatShow=false;
    },
    showSeatDetail(){
      this.seatShow=true;
      this.getSeatDetailList();
    },
    tablerowChange(){},
    modrowChange(val){
      this.modCurrentRow=val.id;
    },
    // 右键弹窗
    openRightStart(){
      this.rightStartWin=true;
    },
    closeRight(){
      this.rightStartWin=false;
    },
    desClass(){
      this.getRequest("/sch/bus/plan/doXiaoban?bus_plan_id="+this.currentRow).then(data=>{
        if(data.data[0]==0){
          this.$message({
          message: data.data[1],
          type: 'success'
        });
        }else{
          this.$message.error(data.data[1]);
        }
      })
    },
    rStartClass(){
      this.postRequest("/sch/bus/plan/doKaiban",{
        kaiban_type:this.rStart.openType,
        start_date:this.rStart.startDate?this.dateToString(this.rStart.startDate):"",
        end_date:this.rStart.endDate?this.dateToString(this.rStart.endDate):"",
        synchro:this.rStart.tongbu?this.rStart.tongbu:"",
        bus_plan_id:this.currentRow
      }).then(data=>{
        if(data.data[0]==0){
          this.$message({
            message: data.data[1],
            type: 'success'
          });
          this.closeRight();
        }else{
          this.$message.error(data.data[1]);
        }
      })
    },
    openRightStop(){
      this.rightStopWin=true;
    },
    closeStop(){
      this.rightStopWin=false;
    },
    rStopClass(){
      console.log(this.rStop);
      this.getRequest("/sch/bus/plan/doTingban?stop_type="+this.rStop.longStop+"&start_date="+this.dateToString(this.rStop.beginDate)+"&end_date="+this.dateToString(this.rStop.endDate)+"&synchro="+this.rStop.tongbuSet+"&reason="+this.rStop.stopRea+"&bus_plan_id="+this.currentRow).then(data=>{
        if(data.data[0]==0){
          this.$message({
            message: data.data[1],
            type: 'success'
          });
          this.closeStop();
        }else{
          this.$message.error(data.data[1]);
        }
      })
    },
    openRightSum(){
      this.rightSumWin=true;
      this.getSumList();
    },
    closeSum(){
      this.rightSumWin=false;
    },
    getSumList(){
      this.postRequest("/sch/bus/plan/list").then(data=>{
        this.sumList.data=data.data.list
      })
    },
    rSum(){
      console.log(this.currentMsg.id)
      this.postRequest("/sch/bus/plan/doBingban",{
        _from:this.currentMsg.id,
        _to:this.sumID,
        remark:this.sumBei.beizhu?this.sumBei.beizhu:"无"
      }).then(data=>{
        if(data.data[0]==0){
          this.$message({
            message: data.data[1],
            type: 'success'
          });
          this.closeSum();
        }else{
          this.$message.error(data.data[1]);
        }
      });
    },
    rSumCurrentRow(val){
      this.sumID=val.id
      this.sumDate=val.bus_date;
      this.sumMsg=val;
      console.log(val)
    },
    openCopy1(){
      this.rightCopywin1=true;
    },
    copyConfirm(){
      this.getRequest("/sch/bus/plan/price/copyToSameLine?bus_plan_id="+this.currentMsg.id+"&to_all_days=false&keep_status="+this.copyCheck).then(data=>{
        if(data.data[0]==0){
          this.$message({
            message: data.data[1],
            type: 'success'
          });
          this.discopy();
        }else{
          this.$message.error(data.data[1]);
        }
      })
    },
    discopy(){
      this.rightCopywin1=false;
    },
    openCopy2(){
      this.rightCopywin2=true;
    },
    discopy2(){
      this.rightCopywin2=false;
    },
    copyConfirm2(){
      this.getRequest("/sch/bus/plan/price/copyToSameLine?bus_plan_id="+this.currentMsg.id+"&to_all_days=true&keep_status="+this.copyCheck2).then(data=>{
        if(data.data[0]==0){
          this.$message({
            message: data.data[1],
            type: 'success'
          });
          this.discopy2();
        }else{
          this.$message.error(data.data[1]);
        }
      })
    },
    openRightCopy(){
      this.rightCopyAll=true;
    },
    closeCopy(){
      this.rightCopyAll=false;
    },
    docopyCheck(){
      this.getcopyList();
    },
    getcopyList(){
      this.postRequest("/sch/bus/plan/copylist",{
        bus_plan_id:this.currentRow,
        be_busdate:this.dateToString(this.copyForm.BanCidate[0]),
        ed_busdate:this.dateToString(this.copyForm.BanCidate[1]),
        line_id:this.currentMsg.line_id
      }).then(data=>{
        this.copyList.data=data.data.list;
      })
    },
    closeCopyDetail(){
      this.rightCopyAll=false;
    },
    rCopyDetail(){
      this.postRequest("/sch/bus/plan/doCopybusInfo",{
        bus_plan_id:this.currentRow,
        // copy_seat:this.copyCheck.copyCheckList1[0]?"on":"off",
        // copy_price:this.copyCheck.copyCheckList1[1]?"on":"off",
        // copy_vehi_no:this.copyCheck.copyCheckList1[2]?"on":"off",
        // copy_customer:this.copyCheck.copyCheckList1[3]?"on":"off",
        // copy_vehi_type:this.copyCheck.copyCheckList1[4]?"on":"off",
        // copy_status:this.copyCheck.copyCheckList1[5]?"on":"off",
        // copy_type:this.copyCheck.copyCheckList1[6]?"on":"off",
        // copy_presell:this.copyCheck.copyCheckList1[7]?"on":"off",
        // copy_checkdoor:this.copyCheck.copyCheckList1[8]?"on":"off",
        // copy_kawei:this.copyCheck.copyCheckList2[0]?"on":"off",
        // copy_is_mix:this.copyCheck.copyCheckList2[1]?"on":"off",
        // copy_is_valid:this.copyCheck.copyCheckList2[2]?"on":"off",
        // copy_is_ot:this.copyCheck.copyCheckList2[3]?"on":"off",
        // copy_is_remote:this.copyCheck.copyCheckList2[4]?"on":"off",
        // copy_end_station:this.copyCheck.copyCheckList2[5]?"on":"off",
        // copy_prn_time:this.copyCheck.copyCheckList2[6]?"on":"off",
        // copy_prn_busid:this.copyCheck.copyCheckList2[7]?"on":"off",
        // copy_prn_seat:this.copyCheck.copyCheckList2[8]?"on":"off",
        bus_plan_ids:this.currentRow
      }).then(data=>{
        if(data.data[0]==0){
          this.$message({
            message: data.data[1],
            type: 'success'
          });
          this.closeCopyDetail();
        }else{
          this.$message.error(data.data[1]);
        }
      })
    }
  },
  computed: {
  },
  components:{DropDown,TableData,FormData,popSubmit,classSort,banciPriceEdit,popDilog},
  watch: {
    road(){
      if(this.road==""){
        this.checkRoadID="";
      }else{
        for(var item of this.roadList){
          if(this.road==item.value){
            this.checkRoadID=item.id
          }
        }
      }
    },
    toPlace(){
      if(this.toPlace==""){
        this.checkEndID="";
      }else{
        for(var item of this.endList){
          if(this.toPlace==item.value){
            this.checkEndID=item.id
          }
        }
      }
    },
  },
  created(){
    this.addClass();
  },
  mounted() {
     this.tableCreate();
     this.getClasList();
      this.postRequest(
        "/sch/bus/plan/getViaStation?bus_plan_id=1635464"
      )
      .then(data => {
        for (var item of data.data) {
          this.peiKeList.push({ label: item.org_name });
        }
    });
  },
};
</script>
<style scoped>
    .prolese{
      width:80%;
      position: relative;
      /* top:30px;
      left:150px; */
      float:right;
    }
    .red{
        color:red;
    }
    .left-set{
     height:550px;
     /* border:1px solid #ddd; */
     width:150px;
     float:left;
     background: #ddd;
    }
    .mod-table{
        height:400px;
    }
    .box-info{
      background:#409eff;
      color:#f1f1f1;
      margin-top:25px;
      height:60px;
      width:100%;
      line-height: 0;
      position:relative;
      border:1px solid yellow;
    }
    .title-right{
       text-align: right;
    }
    .left-title{
      margin-right:20px;
      float:left;
      /* height:calc(60px - 50px); */
      height:50px;
      display: inline-block;
      font-size:20px;
      margin-top:10px;
      line-height: 40px;
    }
    .right-time{
      line-height: 20px;
    }
    .title-center{
      text-align: center;
      margin:10px 0px;
      line-height: 0px;
    }
     .flright{
     display: inline-block;
     position:absolute;
     right:-320px;
     top:15px;
    width:300px;
    border:1px solid #43b3fd;
    height:43px;
    border-radius: 7px;
    z-index:333;
 }
 .flright::before{
        content:' ';
        border-left: 10px solid transparent;
        border-top: 10px solid transparent;
        border-right: 10px solid #387be3;
        border-bottom: 10px solid transparent;
        box-sizing: border-box;
         position: absolute;
        left:-19px;
        top:10px;
 }
 .flright::after {
        position: absolute;
        content: "";
        /*减少两像素*/
        left:-19px;
        top:10px;
        border-left: 10px solid transparent;
        border-top: 10px solid transparent;
        border-right: 10px solid #f1f1ff;
        border-bottom: 10px solid transparent;
    }
    .box-hover{
      margin:0px 20px;
      height:40px;
      /* border:1px solid #ddd; */
      cursor: pointer;
      z-index:44;
      line-height: 40px;
      vertical-align: bottom;
    }
    .box-hover > img{
      margin-top:10px;
    }
    .box-hover :hover{
      background:#387be3;
    }
    .margins{
      padding-left:30px;
    }
    .flos{
      display: inline-block;
    }
    .peis{
      margin-top:-20px;
    }
</style>

